var foodController = require('../../controllers/o2o_merchant/food.server.controller.js');
const multer = require('multer');
const express = require("express");
let upload = multer();
module.exports = (app) => {
    const router = express.Router();
    router.route('/:merchantId')
        .get(foodController.getFoodListByMerchantId);
    let addCpUpload = upload.fields([{ name: 'image', maxCount: 1 }]);
    router.route('/addFood')
        .post(addCpUpload,foodController.addFood);

    let updateCpUpload = upload.fields([{ name: 'image', maxCount: 1 }]);
    router.route('/updateFood')
        .post(updateCpUpload,foodController.updateFood);
    router.route('/:foodId')
        .delete(foodController.deleteFood);

    app.use('/merchant/food', router);
};